<?php
namespace Controller;

require_once("ContentHolderView.php");
require_once("Moduler/Sidebar/SidebarController.php");
require_once('Moduler/Post/PostController.php');
require_once('Moduler/PortfolioGallery/PortfolioGalleryController.php');
require_once ("Moduler/Registration/RegistrationController.php");

class ContentHolderController{
	public function ContentHolderControll($db, $view){
		$chv = new \View\ContentHolderView;
		$sbc = new SidebarController;
		$pc = new PostController;
		$rc = new RegistrationController;
		$portc = new PortfolioGalleryController;
		
		$html = $chv->DoContentStart();
		
		$html .= $chv->DoContentHolderStart();
		
		
		/* Kollar vilken vy som ska visas för användaren. 
		 * beroende på vilket get variabel som skickas med i metoden så bestämmer denna switchfunktion vilken kontroll som ska köras */
		
		switch($view){
			case \View\NavigationView::INDEX:	
				$html .= $pc->DoPostControll($db);
				break;
				
			case \View\NavigationView::REGISTRATION:
				$html .= $rc->DoControll($db);
				break;
				
			case \View\NavigationView::PORTFOLIO:
				$html .= $portc->DoPortfolioControll($db);
				break;
				
			case \View\NavigationView::WEBLOG:
				$html .= $pc->DoPostControll($db);
				break;
		}
		
		$html .= $chv->DoContentHolderEnd();
		
		$html .= $sbc->DoSidebarControll();
		
		$html .= $chv->DoContentEnd();
		
		return $html;
	}
}
?>